Imports SchemaCodeGen

Partial Class pages_Templates_Template : Inherits CPage

#Region "Querystring"
	Public ReadOnly Property TemplateId() As Integer
		Get
			Dim id As Integer = CWeb.RequestInt("templateId")
			If id = Integer.MinValue Then CSitemap.RecordNotFound("Template", id)
			Return id
		End Get
	End Property
#End Region

#Region "Data"
	Public ReadOnly Property [Template]() As CTemplate
		Get
			Dim t As CTemplate = CTemplate.Cache.GetById(TemplateId)
			If IsNothing(t) Then CSitemap.RecordNotFound("Template", TemplateId)
			Return t
		End Get
	End Property
#End Region

#Region "Event Handlers - Page"
	Protected Overrides Sub PageInit()
		ctrlTemplateSets.DisplaySelected(Template)
		ctrlInherits.DisplayRemaining(Template)
	End Sub
	Protected Overrides Sub PageLoad()
		With Me.Template
			txtTemplateName.Text = .TemplateName
			txtPattern.Text = CUtilities.ListToHtml(.TemplateSets.Names) 'CUtilities.CountSummary(.Contents, "pattern")
		End With
	End Sub
#End Region

End Class
